/*
 * Copyright 2004 JavaFree.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.javabb.component;

import java.util.HashMap;
import java.util.Map;

/**
 * $Id: Spy.java,v 1.1.2.4 2007/08/21 21:20:12 daltoncamargo Exp $
 * 
 * @author Dalton Camargo
 */
public class Spy {

	//public static LinkedHashSet topicViews = new LinkedHashSet();
	public static String topicViews = "";
	

	public static void addSpyTopic(Long topicId, String topicTitle,
			String forumName, Long forumId, Long userId, String userName) {
		/*if(topicViews != null && topicViews.size() > 50){
			topicViews.clear();
		}
		LinkedHashSet newTopicViews = new LinkedHashSet();
		newTopicViews.add(message);
		newTopicViews.addAll(topicViews);*/
		HashMap mp = new HashMap();
		mp.put("topicId", topicId);
		mp.put("topicTitle", topicTitle);
		mp.put("forumName", forumName);
		mp.put("forumId", forumId);
		
		//Masking last 2 ipNumbers
		if(userId == null){
			//is an anonymous user
			userName = userName.substring(0, userName.length() - 3);
			userName = userName + "**";
		}
		
		mp.put("userName", userName);
		mp.put("userId", userId);
		
		String msg = VelocityTemplate.makeTemplate(mp, "spy_tbl.vm");
		topicViews = msg;
	}

	public static void set18Messages(Map values){
		/*if(Spy.messagesI18n == null){
			Spy.messagesI18n = new HashMap();
		}
		Spy.messagesI18n = values;*/
	}

	
	
}
